<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script type="text/javascript" src="js/bootstrap.js"></script>
    <script type="text/javascript" src="js/ckform.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/showdate.js"></script>
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <style type="text/css">
        body {
            font-size: 20px;
            padding-bottom: 40px;
            background-color: #e9e7ef;
            font-size: 17px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
</head>
<h3><strong>博客信息：</strong></h3>
<table class="table table-condensed">
    <tr>
        <td width="18%" height="30" align="center">博主名称：</td>
        <td id="uname" width="82%" class="word_grey">

        </td>
    </tr>
    <tr>
        <td height="28" align="center">邮箱</td>
        <td height="28" id="email"></td>
    </tr>
    <tr>
        <td height="28" align="center">发布内容：</td>
        <td height="28" id="content"></td>
    </tr>
    <tr>
        <td height="28" align="center">发布时间：</td>
        <td height="28" id="time"></td>
    </tr>
</table>

<h3><strong>全部评价内容：</strong></h3>
<table class="table table-bordered">
    <thead>
    <tr>
        <th>评价内容</th>
        <th>评价人</th>
        <th>评价时间</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody id="evaluates">
    <%--追加评论信息--%>
    <%--        <td>这是一个不错的电影</td>--%>
    <%--        <td>2022-04-01</td>--%>
    <%--		<td><button type="button"  id="deletecomment">删除</button></td>--%>
    </tbody>
</table>
<script type="text/javascript">

    function findBlogById() {
        $.ajax({
            url: "blog/findBlogById",
            type: "POST",
            data: {"bid":${param.bid}},
            dataType: "json",
            success: function (result) {
                //博客基本信息
                $("#uname").append(`<a   href="user_detail.jsp?uid=` + result.user.uid + `" >` + result.user.uname + `</a>`);
                $("#email").text(result.user.email);
                $("#content").text(result.blog.bcontent);
                $("#time").text(result.blog.date);

                //设置评价信息：
                $.each(result.evaluate, function (index, item) {
                    var trs = `<tr>
                            <td style="display: none">` + item.eid + `</td>
                            <td id="">` + item.econtent + `</td>
                            <td><a href="user_detail.jsp?uid=` + result.user.uid + `">` + result.user.uname + `</a></td>
                            <td>` + item.etime + `</td>
                            <td><button type="button"  class="deleteEva">删除</button></td>
                            </tr>`;
                    //追加在tbody
                    $("#evaluates").append(trs);
                })
            }
        })
    }

    $(function () {
        //博客详情
        findBlogById();
    });
</script>
</body>

</html>
